﻿@page "/{handler?}"


@namespace Blog.MVP.Blazor.SSR.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    Layout = null;
    var userName = User.Claims.Where(c => c.Type.Equals("name"))
                    .Select(c => c.Value)
                    .FirstOrDefault();
}

@model _HostAuthModel


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Blog.MVP.Blazor.SSR</title>
    <base href="~/" />
    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    <link href="css/site.css" rel="stylesheet" />
</head>
<body>



    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container-fluid">
            <div class="width100p menu width100% d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom box-shadow" style="width:100%;">
                <!--Site name -->
                <h3 class="menu-logo my-0 mr-md-auto font-weight-normal"><a class="logo" href="/">Blog.MVP.Blazor.SSR</a></h3>
                @if (User.Identity.IsAuthenticated)
                {
                    <div id="logined" style="display: contents;">
                        <div class="menu-item my-2 my-md-0 mr-md-3 dropdown">
                            <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                                设置 - <span id="username">@(userName) </span>
                            </button>
                            <div class="dropdown-menu">

                            </div>
                        </div>
                        <a class="menu-item my-2 btn btn-outline-primary" href="/logout">注销</a>
                    </div>
                }
                else
                {
                    <div id="accessed">
                        <a class="menu-item my-2 btn btn-outline-primary" href="/login">登入</a>
                    </div>
                }
            </div>

        </div>
    </div>



    <app>
        <component type="typeof(App)" render-mode="ServerPrerendered" />
    </app>

    <div id="blazor-error-ui">
        <environment include="Staging,Production">
            An error has occurred. This application may no longer respond until reloaded.
        </environment>
        <environment include="Development">
            An unhandled exception has occurred. See browser dev tools for details.
        </environment>
        <a href="" class="reload">Reload</a>
        <a class="dismiss">🗙</a>
    </div>

    <script src="_framework/blazor.server.js"></script>

</body>
</html>
